<?php
namespace app\crm\controller;
use app\common\controller\UserBase; 
use app\crm\model\CrmCustomer;
use app\crm\model\CrmContact;
use app\crm\model\CrmUser;
use app\user\model\FieldData;
use app\user\model\User;

class Detail extends UserBase
{
    public function initialize()
    {
        parent::initialize();
        //获取字段列表
        $this->field = FieldData::get_field_list('1');
        //获取客服列表
        $this->kefu = get_dict_list('5');
    }
    //详情页
    public function index($id,$show='customer')
    {   
        $customer = new CrmCustomer();
        //获取数据
        $data = $customer->with(['crmuser','crmcontact'])->where('id',$id)->find();
        
   //     $this->result($data);
        return $this->fetch('index',[
            'data'  => $data,
            'show'  => $show,
            'field' => $this->field,
            'kefu'  => $this->kefu,
        ]);
    }
    
    
    
}
